#ifndef UTILITY_H_
#define UTILITY_H_

#include "data.h"

#include <GL/glew.h>
#include <GL/glut.h>
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#include <string>

void initGLUT(int argc, char** argv);
void initGLEW();
void set1to1Mapping(const int size);

void setupTexture(const int size, GLuint * texture);

void setupTexture(GLuint * tex, const int size, const GLenum attach,
        const float4 * h_values);



void copyTextureFromGPU(const GLenum attachment, const int size, float4 * h_data);
void copyTextureToGPU(const GLenum attachment, GLuint texture, const int size, float4 * h_data);


void initCg(const char * source, const char * entry,
        CGprofile & profile, CGcontext & context, CGprogram & program);

void glQuad(const int size);

void printData(const int size, const float4 * data, const std::string& msg = "");

void checkFramebufferStatus(const std::string& msg);
void cgErrorCallback(const CGcontext& context);
void checkGLErrors(const std::string& msg);

#endif /* UTILITY_H_ */
